
<template>
<div class="experience">
    <implant-menu ref="implant_menu" :pageInfo="menuInfo" :menuData="menuData" @menuCheck="menuCheck"></implant-menu>
</div>
</template>

<script>
import ImplantMenu from "@/components/ImplantMenu.vue"
export default {
    name: "experience",
    components: {
        ImplantMenu
    },
    computed: {},
    data: () => ({
        menuInfo: {
            pageName: "开通体验",
            isShowHelp: true,
            menuStyleClass:'experienceMenuStyle',
            experienceMenuBtnClick:function(){
                alert(1);
            }
        },
        menuData: [
            {
                name: "添加体验账号",
                routerPath: "/experience/organization/account",
                checked: true,
                group: [
                    {
                        name: "单位管理",
                        iconName: "vcloud-Unitmanagement",
                        routerPath: "/experience/organization/account",
                        iframeSrc: "/organization/account.do?method=listAccounts"
                    },
                    {
                        name: "部门管理",
                        iconName: "vcloud-yingyongjieru",
                        routerPath: "/experience/organization/moveDept",
                        iframeSrc: "/organization/department.do?method=showDepartmentFrame&style=tree"
                    }
                ]
            }, {
                name: "体验角色设置",
                routerPath: "/experience/role",
                iframeSrc: "",
                checked: false,
            }, {
                name: "应用部署",
                routerPath: "/experience/deploy",
                iframeSrc: "/#/experience/deploy_page",
                isNoSSO:true,
                checked: false,
            }
        ]
    }),
    async created() {
       let mName=localStorage.getItem("experience_menu");
       let menuDataObj;
       if(mName){
            this.menuData.forEach(item =>{
                item.checked = mName === item.name;
                if(item.checked){
                    menuDataObj = item;
                }
            });
       }
       // let res = await this.api.redirectAddRole({params:{loginName:'c5'}},{method:"get",customRequest:true});
       // if(res&&res.data){
       //      this.menuData[1].iframeSrc =res.data.ssoBean.ssoPrefix+encodeURIComponent(res.data.ssoBean.v5Prefix+res.data.url);
       // }
       // if(mName == '体验角色设置'){
       //      this.$refs.implant_menu.menuClick(menuDataObj);
       // }
       
    },
    mounted() {
    },
    watch: {
    },
    methods: {
        menuCheck(menu) {
            localStorage.setItem("experience_menu", menu.name);
            this.menuData.forEach(item =>{
                item.checked = menu.name === item.name;
            })
        }
    }
}
</script>
<style lang="scss" src="../../assets/styles/experience/index.scss" scoped></style>